package com.yj.core.constants;

import com.yj.core.exception.ApiException;
import com.yj.core.result.BaseExceptionMsg;

/**
 * 互联网医院平台全局常量定义
 *
 * @author cyj
 * @date 19-03-13
 */
public final class GlobalConstants {

    /**
     * 编码
     */
    public static final String CHARSET = "UTF-8";

    /**
     * 朔维平台默认hosId
     */
    public static final Long SWIFT_HOS_ID = 0L;

    /**
     * 交大一附院平台默认hosId
     */
    public static final Long JDYFY_HOS_ID = 100L;

    /**
     * 交大一附院东院区 平台默认hosId
     */
    public static final Long JDYFY_DYQ_HOS_ID = 101L;

    /**
     * 西安市第三医院 平台默认hosId
     */
    public static final Long XAS_DSYY_HOS_ID = 102L;

    /**
     * 状态0
     */
    public static final String STATE_0 = "0";
    /**
     * 状态1
     */
    public static final String STATE_1 = "1";

    /**
     * 商家
     */
    public static final String BUSINESS = "huawei";

    /**
     * base_dept_buss中的flag_switch 标记为常用科室(8421表示)
     */
    public static int DEPT_FLAG_1 = 1;
    /**
     * base_dept_buss中的flag_switch 标记为特色科室科室(8421表示)
     */
    public static int DEPT_FLAG_2 = 2;

    /**
     * 平台用户登录分类
     * 1:患者
     * 2:医生
     * 3:平台管理员
     * 4:第三方用户
     * 5:药店用户
     */
    public static final Integer USER_CATEGORY_PAT = 1;
    public static final Integer USER_CATEGORY_DOCT = 2;
    public static final Integer USER_CATEGORY_MNG = 3;
    public static final Integer USER_CATEGORY_THIRD = 4;
    public static final Integer USER_CATEGORY_PHY = 5;


    /**
     * 登录终端
     * 1:PC
     * 2:APP
     * 3:SUPER 超级客户端
     */
    public static final Integer LOGIN_TERMINAL_PC = 1;
    public static final Integer LOGIN_TERMINAL_APP = 2;
    public static final Integer LOGIN_TERMINAL_SUPER = 3;

    /**
     * 号源类型
     * 0:线上号源
     * 1:线下号源
     */
    public static final String BOOK_DUTY_TYPE_ONLINE = "0";
    public static final String BOOK_DUTY_TYPE_OFFLINE = "1";

    /**
     * 非字典医嘱对应的itemCode
     */
    public static final String ADVICE_RECIPE_ITEM_CODE = "999";
    /**
     * 业务类型
     * 1:挂号
     * 2:咨询
     * -1:其他
     */
    public static final int BUSS_TYPE_REG = 1;
    public static final int BUSS_TYPE_CON = 2;
    public static final int BUSS_TYPE_OHTER = -1;

    /**
     * 0:复诊
     * 1:初诊
     */
    public static final String TREAT_TYPE_0 = "0";
    public static final String TREAT_TYPE_1 = "1";

    /**
     * 　默认问诊时长
     */
    public static final int DEFAULT_REG_MIN = 10;

    /**
     * 号源类型　0线上　1线下
     */
    public static final String DUTYTYPE_0 = "0";
    public static final String DUTYTYPE_1 = "1";


    /**
     * 微服务类别
     */
    /**
     * 本地｜云服务
     */
    public enum CLOUD_TYPE {
        CLOUD("0"),
        LOCAL("1"),
        TRANSACTION("2");

        String cloudType;

        CLOUD_TYPE(String type) {
            cloudType = type;
        }

        public String getCloudType() {
            return cloudType;
        }
    }

    public enum SYNC_OPER {
        insert, update, delete;

        public static SYNC_OPER getOper(String op) {
            for (SYNC_OPER o : values()) {
                if (o.name().equalsIgnoreCase(op)) {
                    return o;
                }
            }
            throw new ApiException(BaseExceptionMsg.DIC_NOT_EXSITS);
        }
    }

    /**
     * 空字符串
     */
    public static final String NULL_STRING = "";


    /**
     * 标识来源网关的请求，
     * 区分请求是来源网关（用户）｜微服务之间的请求
     */
    public static final String REQUEST_GW = "Request-Gw";
    public static final String REQUEST_GW_YES = "yes";
    public static final String REQUEST_GW_NO = "no";

    /**
     * 请求号
     */
    public static final String REQUEST_NO = "Request-No";

    /**
     * header中的spanId，传递规则：request header中传递本服务的id
     */
    public static final String SPAN_ID = "Span-Id";

    /**
     * 验证码有效时间
     */
    public static final Integer VERIFICATION_EXPIRE_TIME = 5;

    /**
     * 语音消息缓存某人有效时间
     */
    public static final long VOICE_CACHE_TIME = 10 * 60;

    /**
     * 绑定手机缓存有效时间
     */
    public static final long BIND_PHONE_CACHE_TIME = 10 * 60;
}
